<!DOCTYPE html>
<meta charset="utf-8">
<title>InstalledApp - origin trial is enabled by script-added meta tag</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../../resources/origin-trials-helper.js"></script>
<script>
// Generate token with the command:
// generate_token.py http://127.0.0.1:8000 InstalledApp --expire-timestamp=2000000000
let token = "Akja9TlIC1gfGeeC9bkfQDkEVUWMgRRPCjxOhbdvY1hs7t5XnI4Nrfd8H0diidi6jrbO6HCXLK0jfMPduTXUKQIAAABUeyJvcmlnaW4iOiAiaHR0cDovLzEyNy4wLjAuMTo4MDAwIiwgImZlYXR1cmUiOiAiSW5zdGFsbGVkQXBwIiwgImV4cGlyeSI6IDIwMDAwMDAwMDB9";

let properties_to_check = {'Navigator': ['getInstalledRelatedApps']};

// Can only run this test if feature is not enabled via a Chrome flag.
// That is only the case when running this in a virtual test suite (by default,
// runtime enabled features are on for layout tests).
if (!self.internals.runtimeFlags.installedAppEnabled) {
  test(t => {
    OriginTrialsHelper.check_properties_missing(this, properties_to_check);
  }, "InstalledApp related properties is not on interfaces before adding trial token via script.");
}

OriginTrialsHelper.add_token(token);

test(t => {
  OriginTrialsHelper.check_properties_exist(this, properties_to_check);
}, "InstalledApp related properties is on interfaces after adding trial token via script.");
</script>
